package ttc.sftp.adapter;

import java.util.List;
import java.util.Vector;

import com.jcraft.jsch.ChannelSftp;
import com.jcraft.jsch.SftpException;

import ttc.sftp.R;
import ttc.sftp.data.LocalData;
import ttc.sftp.data.RemoteFile;
import ttc.sftp.data.SFile;
import ttc.sftp.data.VFile;
import ttc.sftp.user.AllUser;
import ttc.sftp.user.User;
import android.content.Context;
import android.support.v4.view.PagerAdapter;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

public class UserAdapter extends BaseAdapter {

	private Vector<User> vectorUsers;
	private User user;
	LayoutInflater inflater;
	private AllUser allUser;
	
	public UserAdapter(LayoutInflater inflater,Context context){
		this.inflater= inflater;
		vectorUsers= User.getVectorUser(context);
	}

	
	public void setpath(){
		vectorUsers.clear();
		vectorUsers = allUser.getVectorUser();
	}
	
	public User getUser(){
		return allUser.getUser();
	}


	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return vectorUsers.size();
	}


	@Override
	public Object getItem(int position) {
		// TODO Auto-generated method stub
		return vectorUsers.elementAt(position);
	}


	@Override
	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return position;
	}
	
	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		View row = convertView;
		if(row==null){
			row = inflater.inflate(R.layout.show_account, parent,false);
		}
		ImageView icon =(ImageView)row.findViewById(R.id.imgViewLogo);
		TextView name =(TextView)row.findViewById(R.id.txtViewTitle);
		TextView description =(TextView)row.findViewById(R.id.txtViewDescription);
		icon.setImageResource(R.drawable.enable_server);
		name.setText(vectorUsers.get(position).getHost());
		description.setText(vectorUsers.get(position).getUsername());
		return row;
	}
	
	


}
